 <?php
	print("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?> \n");
	print("<CID>\n");
	if(!isset($_GET["CID"]))
	{
		print("</CID>\n");
		return;
	}
	$db = mysql_connect("localhost","root","root");
    mysql_select_db("brainway");
	$query = "delete from case_discription where CID=".$_GET["CID"];
    $result = mysql_query($query);
    if($result==null)       //name has existed
    {
        print("<error>0</error>");
        print("</CID>\n");
		return;
    }
    $query = "delete from datasource_knowledge
                where DID in 
                (   select datasource_name.DID from datasource_name where CID=".$_GET["CID"]."
                )";
    $result = mysql_query($query);
    if($result==null)       //name has existed
    {
        print("<error>1</error>");
        print("</CID>\n");
		return;
    }
    $query = "delete from datasource_discription
                where DID in
                (   select datasource_name.DID from datasource_name where CID=".$_GET["CID"]."
                )";
    $result = mysql_query($query);
    if($result==null)       //name has existed
    {
        print("<error>2</error>");
        print("</CID>\n");
		return;
    }
    $query = "delete from datasource_name
                where CID=".$_GET["CID"];
    $result = mysql_query($query);
    if($result==null)       //name has existed
    {
        print("<error>3</error>");
        print("</CID>\n");
		return;
    }
    $query = "delete from case_name where CID=".$_GET["CID"];
    $result = mysql_query($query);
    if($result==null)       //name has existed
    {
        print("<error>4</error>");
        print("</CID>\n");
		return;
    }
    
    print($_GET["CID"]."</CID> \n");
?>